home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / pvm34b3.zip / pvm34b3 / pvm3 / src / tvdefs.h < prev    next >
Text File  |  1997-07-22  |  3KB  |  87 lines

  1.  
  2. /* $Id: tvdefs.h,v 1.3 1997/06/25 22:11:14 pvmsrc Exp $ */
  3.  
  4. /*
  5.  *         PVM version 3.4:  Parallel Virtual Machine System
  6.  *               University of Tennessee, Knoxville TN.
  7.  *           Oak Ridge National Laboratory, Oak Ridge TN.
  8.  *                   Emory University, Atlanta GA.
  9.  *      Authors:  J. J. Dongarra, G. E. Fagg, M. Fischer
  10.  *          G. A. Geist, J. A. Kohl, R. J. Manchek, P. Mucci,
  11.  *         P. M. Papadopoulos, S. L. Scott, and V. S. Sunderam
  12.  *                   (C) 1997 All Rights Reserved
  13.  *
  14.  *                              NOTICE
  15.  *
  16.  * Permission to use, copy, modify, and distribute this software and
  17.  * its documentation for any purpose and without fee is hereby granted
  18.  * provided that the above copyright notice appear in all copies and
  19.  * that both the copyright notice and this permission notice appear in
  20.  * supporting documentation.
  21.  *
  22.  * Neither the Institutions (Emory University, Oak Ridge National
  23.  * Laboratory, and University of Tennessee) nor the Authors make any
  24.  * representations about the suitability of this software for any
  25.  * purpose.  This software is provided ``as is'' without express or
  26.  * implied warranty.
  27.  *
  28.  * PVM version 3 was funded in part by the U.S. Department of Energy,
  29.  * the National Science Foundation and the State of Tennessee.
  30.  */
  31.  
  32. /*
  33.  *    tvdefs.h
  34.  *
  35.  *    Timeval manipulation stuff.
  36.  *
  37. $Log: tvdefs.h,v $
  38.  * Revision 1.3  1997/06/25  22:11:14  pvmsrc
  39.  * Markus adds his frigging name to the author list of
  40.  *     every file he ever looked at...
  41.  *
  42.  * Revision 1.2  1997/01/28  19:28:36  pvmsrc
  43.  * New Copyright Notice & Authors.
  44.  *
  45.  * Revision 1.1  1996/09/23  23:43:39  pvmsrc
  46.  * Initial revision
  47.  *
  48.  * Revision 1.2  1994/06/03  20:38:32  manchek
  49.  * version 3.3.0
  50.  *
  51.  * Revision 1.1  1993/08/30  23:26:52  manchek
  52.  * Initial revision
  53.  *
  54.  */
  55.  
  56.  
  57. #define    TVCLEAR(tvp)    ((tvp)->tv_sec = (tvp)->tv_usec = 0)
  58.  
  59. #define    TVISSET(tvp)    ((tvp)->tv_sec || (tvp)->tv_usec)
  60.  
  61. #define    TVXLTY(xtv, ytv) \
  62.     ((xtv)->tv_sec < (ytv)->tv_sec || \
  63.         ((xtv)->tv_sec == (ytv)->tv_sec && (xtv)->tv_usec < (ytv)->tv_usec))
  64.  
  65. #define    TVXADDY(ztv, xtv, ytv)    \
  66.     if (((ztv)->tv_usec = (xtv)->tv_usec + (ytv)->tv_usec) < 1000000) {    \
  67.         (ztv)->tv_sec = (xtv)->tv_sec + (ytv)->tv_sec;    \
  68.     } else {    \
  69.         (ztv)->tv_usec -= 1000000;    \
  70.         (ztv)->tv_sec = (xtv)->tv_sec + (ytv)->tv_sec + 1;    \
  71.     }
  72.  
  73. #define    TVXSUBY(ztv, xtv, ytv)    \
  74.     if ((xtv)->tv_usec >= (ytv)->tv_usec) {    \
  75.         (ztv)->tv_sec = (xtv)->tv_sec - (ytv)->tv_sec;    \
  76.         (ztv)->tv_usec = (xtv)->tv_usec - (ytv)->tv_usec;    \
  77.     } else {    \
  78.         (ztv)->tv_sec = (xtv)->tv_sec - (ytv)->tv_sec - 1;    \
  79.         (ztv)->tv_usec = (xtv)->tv_usec + 1000000 - (ytv)->tv_usec;    \
  80.     }
  81.  
  82. #define    TVDIVN(ytv, xtv, n)    { \
  83.     (ytv)->tv_usec = \
  84.         (((xtv)->tv_usec + 1000000 * ((xtv)->tv_sec % (n))) / (n)); \
  85.     (ytv)->tv_sec = ((xtv)->tv_sec / (n)); }
  86.  
  87.